/*
 * @Author: weikang
 * @Description:
 * @Date: 2024-01-08 20:59:43
 * @LastEditTime: 2025-06-13 20:45:16
 * @FilePath: \env-manager-pc\src\api\modules\document.ts
 */
import api from '../index'
import type { DeviceRow, EnumOption, ScenariosData, ScenariosPackage } from './types/document'
import type { QueryData, RowListRes } from './types/ent'
import type { BlueToothVersion, DuiBi, DveiceVersion, GPRSVersion, GPRS_CONFIG, GPRS_QUERY, GPRS_SET, GPRS_STATUS, UpdateData, UpdateRecord } from '@/views/document/device/detail/model/page'

export default {
  // 设备列表
  GetElectricDeviceList: (data: QueryData) => api<RowListRes<DeviceRow>>({
    url: `/Env/GetElectricDeviceList`,
    method: 'post',
    data,
  }),
  // 重启设备
  DeviceRestart: (data: { deviceObjID: string }) => api({
    url: `/Obj/Device/HJ212/GYHR/Restart`,
    method: 'post',
    data,
  }),
  // 参数及数据区初始化
  DeviceInit: (data: { deviceObjID: string }) => api({
    url: `/Obj/Device/HJ212/GYHR/Init`,
    method: 'post',
    data,
  }),
  // 召测时钟
  DeviceCallDateTime: (data: { deviceObjID: string }) => api<string>({
    url: `/Obj/Device/HJ212/CallDateTime`,
    method: 'post',
    data,
  }),
  // 下发时钟
  DeviceSetDateTime: (data: { deviceObjID: string, dateTime: string }) => api({
    url: `/Obj/Device/HJ212/SetDateTime`,
    method: 'post',
    data,
  }),
  // 查询采集器
  DeviceGetVersion: (data: { deviceObjID: string }) => api<DveiceVersion>({
    url: `/Obj/Device/HJ212/GYHR/GetVersion`,
    method: 'post',
    data,
  }),
  // 召测采集器
  DeviceCallVersion: (data: { deviceObjID: string }) => api<DveiceVersion>({
    url: `/Obj/Device/HJ212/GYHR/CallVersion`,
    method: 'post',
    data,
  }),
  // 查询GPRS版本
  DeviceGetGPRSVersion: (data: GPRS_QUERY) => api<GPRSVersion>({
    url: `/Obj/Device/HJ212/GYHR/GetGPRSVersion`,
    method: 'post',
    data,
  }),
  // 查询GPRS状态
  DeviceGetGPRSStatus: (data: GPRS_QUERY) => api<GPRS_STATUS>({
    url: `/Obj/Device/HJ212/GYHR/GetGPRSStatus`,
    method: 'post',
    data,
  }),
  // 查询GPRS配置
  DeviceGetCommunicateConfig: (data: GPRS_QUERY) => api({
    url: `/Obj/Device/HJ212/GYHR/GetCommunicateConfig`,
    method: 'post',
    data,
  }),
  // 召测GPRS配置
  DeviceCallGPRSVersion: (data: GPRS_QUERY) => api<GPRSVersion>({
    url: `/Obj/Device/HJ212/GYHR/CallGPRSVersion`,
    method: 'post',
    data,
  }),
  // 召测GPRS状态
  DeviceCallGPRSStatus: (data: GPRS_QUERY) => api<GPRS_STATUS>({
    url: `/Obj/Device/HJ212/GYHR/CallGPRSStatus`,
    method: 'post',
    data,
  }),
  // 召测GPRS配置
  DeviceCallCommunicateConfig: (data: GPRS_QUERY) => api<GPRS_CONFIG>({
    url: `/Obj/Device/HJ212/GYHR/CallCommunicateConfig`,
    method: 'post',
    data,
  }),
  // 设置GPRS配置
  DeviceSetCommunicateConfig: (data: GPRS_SET) => api({
    url: `/Obj/Device/HJ212/GYHR/SetCommunicateConfig`,
    method: 'post',
    data,
  }),
  // 查询对比
  DeviceGetDeviceElectricArchive: (data: { deviceObjIDs: [string] }) => api<DuiBi>({
    url: `/Electric/GetDeviceElectricArchive`,
    method: 'post',
    data,
  }),
  // 召测对比
  DeviceCallMeterParam: (data: { deviceObjID: string }) => api<DuiBi>({
    url: `/Obj/Device/HJ212/GYHR/CallMeterParam`,
    method: 'post',
    data,
  }),
  // 设置对比
  DeviceSetMeterParam: (data: { deviceObjID: string, meterParam: DuiBi }) => api({
    url: `/Obj/Device/HJ212/GYHR/SetMeterParam`,
    method: 'post',
    data,
  }),
  // 接线枚举
  GetEnumInfos: (data: { type: string }) => api<EnumOption[]>({
    url: `/System/GetEnumInfos`,
    method: 'post',
    data,
  }),
  // 最近升级记录
  DeviceCallLastUpgrade: (data: { deviceObjID: string }) => api<UpdateRecord>({
    url: `/Obj/Device/HJ212/GYHR/CallLastUpgrade`,
    method: 'post',
    data,
  }),
  // 开始升级
  DeviceStartUpgrade: (data: UpdateData) => api({
    url: `/Obj/Device/HJ212/GYHR/StartUpgrade`,
    method: 'post',
    data,
  }),
  // 开始升级
  GetLastUpgrade: (data: { deviceObjID: string }) => api<UpdateRecord>({
    url: `/Obj/Device/HJ212/GYHR/GetLastUpgrade`,
    method: 'post',
    data,
  }),
  // 停止升级
  DeviceStopUpgrade: (data: { deviceObjID: string }) => api({
    url: `/Obj/Device/HJ212/GYHR/StopUpgrade`,
    method: 'post',
    data,
  }),
  // 查询蓝牙
  DeviceGetBluetoothVersion: (data: { deviceObjID: string }) => api<DveiceVersion>({
    url: `/Obj/Device/HJ212/GYHR/GetBluetoothVersion`,
    method: 'post',
    data,
  }),
  // 召测蓝牙
  DeviceCallBluetoothVersion: (data: { deviceObjID: string }) => api<DveiceVersion>({
    url: `/Obj/Device/HJ212/GYHR/CallBluetoothVersion`,
    method: 'post',
    data,
  }),
  // 召测蓝牙状态
  DeviceCallBluetoothStatus: (data: { deviceObjID: string }) => api<BlueToothVersion>({
    url: `/Obj/Device/HJ212/GYHR/CallBluetoothStatus`,
    method: 'post',
    data,
  }),
  // 获取方案包
  DeviceGetScenarioPackage: (data: { deviceObjID: string }) => api<ScenariosData>({
    url: `/Obj/Device/HJ212/GYHR/GetScenarioPackage`,
    method: 'post',
    data,
  }),
  // 召测方案包
  DeviceCallScenario: (data: { deviceObjID: string, scenarioID: number }) => api<ScenariosPackage>({
    url: `/Obj/Device/HJ212/GYHR/CallScenario`,
    method: 'post',
    data,
  }),
  // 设置方案包
  DeviceSetScenario: (data: { deviceObjID: string, scenario: ScenariosPackage }) => api({
    url: `/Obj/Device/HJ212/GYHR/SetScenario`,
    method: 'post',
    data,
  }),
  // 责任单位类型
  GetOwnerOrgClassifys: () => api({
    url: `/Obj/OwnerOrg/GetOwnerOrgClassifys`,
    method: 'post',
  }),
  // 导出企业列表
  GetEnterpriseAndDeviceNumsToExcel: (data: any) => api({
    url: `/Env/GetEnterpriseAndDeviceNumsToExcel`,
    method: 'post',
    data,
    responseType: 'blob',
  }),
  // 导出企业档案
  GetEnterpriseToExcel: (data: {
    entID: string
  }) => api({
    url: `/Env/GetEnterpriseToExcel`,
    method: 'post',
    data,
    responseType: 'blob',
  }),

}
